using System; 
using System.Text; 
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration; 
using System.Xml; 
using System.Xml.Serialization;
using SubSonic; 
using SubSonic.Utilities;
namespace Medianamik.Core.DAL.SubSonicDAL
{
    /// <summary>
    /// Strongly-typed collection for the UrlXmlDoc class.
    /// </summary>
    [Serializable]
    public partial class UrlXmlDocCollection : ReadOnlyList<UrlXmlDoc, UrlXmlDocCollection>
    {        
        public UrlXmlDocCollection() {}
    }
    /// <summary>
    /// This is  Read-only wrapper class for the vw_medianamik_UrlXmlDoc view.
    /// </summary>
    [Serializable]
    public partial class UrlXmlDoc : ReadOnlyRecord<UrlXmlDoc>, IReadOnlyRecord
    {
    
	    #region Default Settings
	    protected static void SetSQLProps() 
	    {
		    GetTableSchema();
	    }
	    #endregion
        #region Schema Accessor
	    public static TableSchema.Table Schema
        {
            get
            {
                if (BaseSchema == null)
                {
                    SetSQLProps();
                }
                return BaseSchema;
            }
        }
    	
        private static void GetTableSchema() 
        {
            if(!IsSchemaInitialized)
            {
                //Schema declaration
                TableSchema.Table schema = new TableSchema.Table("vw_medianamik_UrlXmlDoc", TableType.View, DataService.GetInstance("MedianamikProvider"));
                schema.Columns = new TableSchema.TableColumnCollection();
                schema.SchemaName = @"dbo";
                //columns
                
                TableSchema.TableColumn colvarNodeId = new TableSchema.TableColumn(schema);
                colvarNodeId.ColumnName = "NodeId";
                colvarNodeId.DataType = DbType.Guid;
                colvarNodeId.MaxLength = 0;
                colvarNodeId.AutoIncrement = false;
                colvarNodeId.IsNullable = false;
                colvarNodeId.IsPrimaryKey = false;
                colvarNodeId.IsForeignKey = false;
                colvarNodeId.IsReadOnly = false;
                
                schema.Columns.Add(colvarNodeId);
                
                TableSchema.TableColumn colvarTypeId = new TableSchema.TableColumn(schema);
                colvarTypeId.ColumnName = "TypeId";
                colvarTypeId.DataType = DbType.Guid;
                colvarTypeId.MaxLength = 0;
                colvarTypeId.AutoIncrement = false;
                colvarTypeId.IsNullable = false;
                colvarTypeId.IsPrimaryKey = false;
                colvarTypeId.IsForeignKey = false;
                colvarTypeId.IsReadOnly = false;
                
                schema.Columns.Add(colvarTypeId);
                
                TableSchema.TableColumn colvarCreatedOn = new TableSchema.TableColumn(schema);
                colvarCreatedOn.ColumnName = "CreatedOn";
                colvarCreatedOn.DataType = DbType.DateTime;
                colvarCreatedOn.MaxLength = 0;
                colvarCreatedOn.AutoIncrement = false;
                colvarCreatedOn.IsNullable = false;
                colvarCreatedOn.IsPrimaryKey = false;
                colvarCreatedOn.IsForeignKey = false;
                colvarCreatedOn.IsReadOnly = false;
                
                schema.Columns.Add(colvarCreatedOn);
                
                TableSchema.TableColumn colvarPath = new TableSchema.TableColumn(schema);
                colvarPath.ColumnName = "Path";
                colvarPath.DataType = DbType.AnsiString;
                colvarPath.MaxLength = 500;
                colvarPath.AutoIncrement = false;
                colvarPath.IsNullable = false;
                colvarPath.IsPrimaryKey = false;
                colvarPath.IsForeignKey = false;
                colvarPath.IsReadOnly = false;
                
                schema.Columns.Add(colvarPath);
                
                TableSchema.TableColumn colvarDepth = new TableSchema.TableColumn(schema);
                colvarDepth.ColumnName = "Depth";
                colvarDepth.DataType = DbType.Int32;
                colvarDepth.MaxLength = 0;
                colvarDepth.AutoIncrement = false;
                colvarDepth.IsNullable = false;
                colvarDepth.IsPrimaryKey = false;
                colvarDepth.IsForeignKey = false;
                colvarDepth.IsReadOnly = false;
                
                schema.Columns.Add(colvarDepth);
                
                TableSchema.TableColumn colvarPosition = new TableSchema.TableColumn(schema);
                colvarPosition.ColumnName = "Position";
                colvarPosition.DataType = DbType.Int16;
                colvarPosition.MaxLength = 0;
                colvarPosition.AutoIncrement = false;
                colvarPosition.IsNullable = false;
                colvarPosition.IsPrimaryKey = false;
                colvarPosition.IsForeignKey = false;
                colvarPosition.IsReadOnly = false;
                
                schema.Columns.Add(colvarPosition);
                
                TableSchema.TableColumn colvarParentNodeId = new TableSchema.TableColumn(schema);
                colvarParentNodeId.ColumnName = "ParentNodeId";
                colvarParentNodeId.DataType = DbType.Guid;
                colvarParentNodeId.MaxLength = 0;
                colvarParentNodeId.AutoIncrement = false;
                colvarParentNodeId.IsNullable = true;
                colvarParentNodeId.IsPrimaryKey = false;
                colvarParentNodeId.IsForeignKey = false;
                colvarParentNodeId.IsReadOnly = false;
                
                schema.Columns.Add(colvarParentNodeId);
                
                TableSchema.TableColumn colvarCultureName = new TableSchema.TableColumn(schema);
                colvarCultureName.ColumnName = "CultureName";
                colvarCultureName.DataType = DbType.String;
                colvarCultureName.MaxLength = 10;
                colvarCultureName.AutoIncrement = false;
                colvarCultureName.IsNullable = false;
                colvarCultureName.IsPrimaryKey = false;
                colvarCultureName.IsForeignKey = false;
                colvarCultureName.IsReadOnly = false;
                
                schema.Columns.Add(colvarCultureName);
                
                TableSchema.TableColumn colvarRevision = new TableSchema.TableColumn(schema);
                colvarRevision.ColumnName = "Revision";
                colvarRevision.DataType = DbType.Int32;
                colvarRevision.MaxLength = 0;
                colvarRevision.AutoIncrement = false;
                colvarRevision.IsNullable = true;
                colvarRevision.IsPrimaryKey = false;
                colvarRevision.IsForeignKey = false;
                colvarRevision.IsReadOnly = false;
                
                schema.Columns.Add(colvarRevision);
                
                TableSchema.TableColumn colvarXml = new TableSchema.TableColumn(schema);
                colvarXml.ColumnName = "Xml";
                colvarXml.DataType = DbType.AnsiString;
                colvarXml.MaxLength = -1;
                colvarXml.AutoIncrement = false;
                colvarXml.IsNullable = true;
                colvarXml.IsPrimaryKey = false;
                colvarXml.IsForeignKey = false;
                colvarXml.IsReadOnly = false;
                
                schema.Columns.Add(colvarXml);
                
                TableSchema.TableColumn colvarLinkOnFirstChild = new TableSchema.TableColumn(schema);
                colvarLinkOnFirstChild.ColumnName = "LinkOnFirstChild";
                colvarLinkOnFirstChild.DataType = DbType.Boolean;
                colvarLinkOnFirstChild.MaxLength = 0;
                colvarLinkOnFirstChild.AutoIncrement = false;
                colvarLinkOnFirstChild.IsNullable = true;
                colvarLinkOnFirstChild.IsPrimaryKey = false;
                colvarLinkOnFirstChild.IsForeignKey = false;
                colvarLinkOnFirstChild.IsReadOnly = false;
                
                schema.Columns.Add(colvarLinkOnFirstChild);
                
                TableSchema.TableColumn colvarGeneration = new TableSchema.TableColumn(schema);
                colvarGeneration.ColumnName = "Generation";
                colvarGeneration.DataType = DbType.Int32;
                colvarGeneration.MaxLength = 0;
                colvarGeneration.AutoIncrement = false;
                colvarGeneration.IsNullable = true;
                colvarGeneration.IsPrimaryKey = false;
                colvarGeneration.IsForeignKey = false;
                colvarGeneration.IsReadOnly = false;
                
                schema.Columns.Add(colvarGeneration);
                
                
                BaseSchema = schema;
                //add this schema to the provider
                //so we can query it later
                DataService.Providers["MedianamikProvider"].AddSchema("vw_medianamik_UrlXmlDoc",schema);
            }
        }
        #endregion
        
        #region Query Accessor
	    public static Query CreateQuery()
	    {
		    return new Query(Schema);
	    }
	    #endregion
	    
	    #region .ctors
	    public UrlXmlDoc()
	    {
            SetSQLProps();
            SetDefaults();
            MarkNew();
        }
        public UrlXmlDoc(bool useDatabaseDefaults)
	    {
		    SetSQLProps();
		    if(useDatabaseDefaults)
		    {
				ForceDefaults();
			}
			MarkNew();
	    }
	    
	    public UrlXmlDoc(object keyID)
	    {
		    SetSQLProps();
		    LoadByKey(keyID);
	    }
    	 
	    public UrlXmlDoc(string columnName, object columnValue)
        {
            SetSQLProps();
            LoadByParam(columnName,columnValue);
        }
        
	    #endregion
	    
	    #region Props
	    
          
        [XmlAttribute("NodeId")]
        [Bindable(true)]
        public Guid NodeId 
	    {
		    get
		    {
			    return GetColumnValue<Guid>("NodeId");
		    }
            set 
		    {
			    SetColumnValue("NodeId", value);
            }
        }
	      
        [XmlAttribute("TypeId")]
        [Bindable(true)]
        public Guid TypeId 
	    {
		    get
		    {
			    return GetColumnValue<Guid>("TypeId");
		    }
            set 
		    {
			    SetColumnValue("TypeId", value);
            }
        }
	      
        [XmlAttribute("CreatedOn")]
        [Bindable(true)]
        public DateTime CreatedOn 
	    {
		    get
		    {
			    return GetColumnValue<DateTime>("CreatedOn");
		    }
            set 
		    {
			    SetColumnValue("CreatedOn", value);
            }
        }
	      
        [XmlAttribute("Path")]
        [Bindable(true)]
        public string Path 
	    {
		    get
		    {
			    return GetColumnValue<string>("Path");
		    }
            set 
		    {
			    SetColumnValue("Path", value);
            }
        }
	      
        [XmlAttribute("Depth")]
        [Bindable(true)]
        public int Depth 
	    {
		    get
		    {
			    return GetColumnValue<int>("Depth");
		    }
            set 
		    {
			    SetColumnValue("Depth", value);
            }
        }
	      
        [XmlAttribute("Position")]
        [Bindable(true)]
        public short Position 
	    {
		    get
		    {
			    return GetColumnValue<short>("Position");
		    }
            set 
		    {
			    SetColumnValue("Position", value);
            }
        }
	      
        [XmlAttribute("ParentNodeId")]
        [Bindable(true)]
        public Guid? ParentNodeId 
	    {
		    get
		    {
			    return GetColumnValue<Guid?>("ParentNodeId");
		    }
            set 
		    {
			    SetColumnValue("ParentNodeId", value);
            }
        }
	      
        [XmlAttribute("CultureName")]
        [Bindable(true)]
        public string CultureName 
	    {
		    get
		    {
			    return GetColumnValue<string>("CultureName");
		    }
            set 
		    {
			    SetColumnValue("CultureName", value);
            }
        }
	      
        [XmlAttribute("Revision")]
        [Bindable(true)]
        public int? Revision 
	    {
		    get
		    {
			    return GetColumnValue<int?>("Revision");
		    }
            set 
		    {
			    SetColumnValue("Revision", value);
            }
        }
	      
        [XmlAttribute("Xml")]
        [Bindable(true)]
        public string Xml 
	    {
		    get
		    {
			    return GetColumnValue<string>("Xml");
		    }
            set 
		    {
			    SetColumnValue("Xml", value);
            }
        }
	      
        [XmlAttribute("LinkOnFirstChild")]
        [Bindable(true)]
        public bool? LinkOnFirstChild 
	    {
		    get
		    {
			    return GetColumnValue<bool?>("LinkOnFirstChild");
		    }
            set 
		    {
			    SetColumnValue("LinkOnFirstChild", value);
            }
        }
	      
        [XmlAttribute("Generation")]
        [Bindable(true)]
        public int? Generation 
	    {
		    get
		    {
			    return GetColumnValue<int?>("Generation");
		    }
            set 
		    {
			    SetColumnValue("Generation", value);
            }
        }
	    
	    #endregion
    
	    #region Columns Struct
	    public struct Columns
	    {
		    
		    
            public static string NodeId = @"NodeId";
            
            public static string TypeId = @"TypeId";
            
            public static string CreatedOn = @"CreatedOn";
            
            public static string Path = @"Path";
            
            public static string Depth = @"Depth";
            
            public static string Position = @"Position";
            
            public static string ParentNodeId = @"ParentNodeId";
            
            public static string CultureName = @"CultureName";
            
            public static string Revision = @"Revision";
            
            public static string Xml = @"Xml";
            
            public static string LinkOnFirstChild = @"LinkOnFirstChild";
            
            public static string Generation = @"Generation";
            
	    }
	    #endregion
	    
	    
	    #region IAbstractRecord Members
        public new CT GetColumnValue<CT>(string columnName) {
            return base.GetColumnValue<CT>(columnName);
        }
        public object GetColumnValue(string columnName) {
            return base.GetColumnValue<object>(columnName);
        }
        #endregion
	    
    }
}
